package com.ding.dailyup.repository;

import com.ding.dailyup.model.StrategyCategory;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
@CacheConfig(cacheNames = "strategy:category:" + StrategyCategory.serialVersionUID)
public interface StrategyCategoryRepository
		extends JpaRepository<StrategyCategory, Long> {
	/**
	 * 查找可用的strategyList
	 * 
	 * @param status
	 * @return
	 */
	@Cacheable(key = "'listAll_' + #p0")
	Optional<List<StrategyCategory>> findAllByStatusOrderBySortKeyDesc(Integer status);
}
